package com.ssh.action.books;

import com.opensymphony.xwork2.ActionContext;
import com.ssh.action.BaseAction;
import com.ssh.entity.Book;
import com.ssh.entity.Entity;

public class BooksAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8573423777895433966L;
	
	private String[] books;

	public String[] getBooks() {
		return this.books;
	}

	public void setBooks(String[] books) {
		this.books = books;
	}
	
	@Override
	public String execute() throws Exception {
		String user = (String) ActionContext.getContext().getSession().get("user");
		
		if(user != null && "aaa".equals(user)) {
			Entity entity = (Book) this.getBean(Book.class);
			setBooks(entity.getBooks());
			return SUCCESS;
		} else {
			return LOGIN;
		}
		
	}

}
